﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace WebCastleWindsor.Models
{
    public class Blog
    {
        /// <summary>
        /// 主键 自增
        /// </summary>
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 标题,最长250
        /// </summary>
        [Required]
        [MaxLength(250,ErrorMessage ="标题最长只能250个字符")]
        public string Title { get; set; }

        /// <summary>
        /// 内容 最短10
        /// </summary>
        [Required]
        [MinLength(10,ErrorMessage ="内容最短需要10个字符")]
        public string Content { get; set; }

        /// <summary>
        /// 博客分类
        /// </summary>
        public BlogCategory Category { get; set; }
        
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        public virtual ICollection<Comment> Comments { get; set; }
    }
}